package com.hzqy.service.statistics;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.hzqy.persistence.dao.statistics.UploadFaiFileDao;
import com.hzqy.service.core.GenericServiceBean;
import com.hzqy.web.vo.StatActiveUserPvUvVo;
import com.hzqy.web.vo.UploadFailFileVo;

@Service
public class UploadFaiFileServiceBean extends GenericServiceBean<UploadFailFileVo, UploadFaiFileDao, Integer>{
	private static final long serialVersionUID = 1L;
	protected final Logger LOG = LoggerFactory.getLogger(getClass());
	
	@Resource
	private UploadFaiFileDao uploadFaiFileDao;
	
	@Override
	public UploadFaiFileDao getEntityDao() {
		return uploadFaiFileDao;
	}
	
	public Map<String,Object> selectUploadFailFileList(UploadFailFileVo uploadFailFileVo,int curPage,int pageSize){
		Map<String,Object> map = new HashMap<String,Object>();
		Integer rowCount = uploadFaiFileDao.selectUploadFailFileCount(uploadFailFileVo);
		map.put("total", rowCount);
		if(rowCount > 0 && curPage > 0 && pageSize > 0) {
			map.put("firstResult", (curPage-1)*pageSize);
			map.put("maxResults", pageSize);
			map.put("f_uff_filename", uploadFailFileVo.getF_uff_filename());
			map.put("f_uff_type", uploadFailFileVo.getF_uff_type());
			map.put("beginDate", uploadFailFileVo.getBeginDate());
			map.put("endDate", uploadFailFileVo.getEndDate());
			List<UploadFailFileVo> results = uploadFaiFileDao.selectUploadFailFileList(map);
			map.put("rows", results);
		} else {
			map.put("rows", new ArrayList<StatActiveUserPvUvVo>());
		}
		return map;
	}

}
